package com.foreknow.service.impl;

import com.foreknow.dao.UserMapper;
import com.foreknow.entity.User;
import com.foreknow.service.UserServicer;
import com.foreknow.utils.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserServicer {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User Login(String username, String password) {


        return userMapper.queryOne(username,password);

    }

    @Override
    public List<User> queryAllUser(String param) {
        return userMapper.findUser(param);
    }

    @Override
    public int deleteById(int id) {
        return userMapper.deleteById(id);
    }

    @Override
    public int insertUserMessage(User user) {


        return userMapper.insetUser(user);
    }

    @Override
    public boolean modifyUser(User user) {
         return userMapper.updateUser(user) == 1;
    }

    @Override
    public User queryUserById(int id) {
        return userMapper.findUserById(id);
    }

    @Override
    public Integer removeUsers(List<Integer> ids) {
        return userMapper.deleteUsersById(ids);
    }


}
